#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from utils import get_abs_path



ignores = ['.idea', '__pycache__']
GIT_URL = 'https://gitee.com/ZDYoung0519/awesome-zxsj/raw/master/'
TEMP_DRR = './TEMP'

def is_ignored(filename):
    for item in ignores:
        if item in filename:
            return True
    return False

all_files = []

def gci(filepath):
    # 遍历filepath下所有文件，包括子目录
    files = os.listdir(filepath)
    for fi in files:
        fi_d = os.path.join(filepath, fi)
        if os.path.isdir(fi_d):
            gci(fi_d)
        else:
            if not is_ignored(fi_d):
                file = fi_d.replace(os.sep, '/').replace('./', '')
                all_files.append(file)




# 递归遍历/root目录下所有文件
gci('./')
print(all_files)

with open('./build_files', 'w', encoding='utf-8') as f:
    for file in all_files:
        f.writelines(file + '\n')